home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group94a.txt
/
000096_icon-group-sender _Fri Apr 22 16:12:00 1994.msg
< prev
next >
Wrap
Internet Message Format
|
1994-08-19
|
3KB
Received: by cheltenham.cs.arizona.edu; Fri, 22 Apr 1994 18:01:20 MST
Date: Fri, 22 Apr 1994 16:12:00 -0600 (CST)
From: Chris Tenaglia - 257-8765 <TENAGLIA@MIS.MCW.EDU>
Subject: ff.icn
To: icon-group@cs.arizona.edu
Message-Id: <01HBHB4TC70Y8WYD3G@mis.mcw.edu>
Organization: Medical College of Wisconsin (Milwaukee, WI)
X-Vms-To: IN%"icon-group@cs.arizona.edu"
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-Transfer-Encoding: 7BIT
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
I haven't seen too many handy doodads recently. I have a unix icon
snippet of code. I guess I was too lazy to figure out the 'find' alias
I'd need, so I pieced together ff (file finder). I wrote it for the
Ultrix unix system. It requires the HOME environmental variable to
search ones directory tree. Don't use it from the root account, and
it only searches the directories beginning at HOME. If you have a
different unix, or your terminal doesn't support ansi highlighting,
you may have to modify some things. It doesn't do regular expressions,
but it does find substrings. Enjoy.
Chris Tenaglia (System Manager) | Medical College of Wisconsin
8701 W. Watertown Plank Rd. | Milwaukee, WI 53226
(414)257-8765 | tenaglia@mis.mcw.edu
#
# FILE : FF.ICN
# DESC : This program does a file find.
# It works only from your home account directory tree.
# Don't use if you're root or looking beyond your user account.
# Highlights substring with ansi sequences.
# USE : ff substr
#
# UPDATE BY WHAT
# 22-APR-1994 TENAGLIA INITIAL WRITE
#
procedure main(param)
home := getenv("HOME")
command := "ls -alR " || home
pipe := open(command,"pr")
part := param[1] | stop("Nothing to ff!")
every drip := !pipe do
{
if match("/",drip) then
{
home := drip[1:upto(":",drip)]
next
}
file := home || "/" || parse(drip,' ')[-1] # construct full filename
if match( ("./" | ".."), file) then next # skip this junk
if find(part,file) then # case sensitive matching
{
drip[46:0] := ""
drip ||:= file
drip[11:24] := ""
i := find(part,drip) - 1 # *** warning ***
j := i + *part # these lines put ansi
(drip[j] ||:= "\e[m") | (drip ||:= "\e[m") # highlighting around
drip[i] ||:= "\e[1m" # the matched substring
write(drip)
}
}
close(pipe)
end
#
# parse a string into a list using a delimiter
#
procedure parse(line,delims)
static chars
chars := &cset -- delims
tokens := []
line ? while tab(upto(chars)) do put(tokens,tab(many(chars)))
return tokens
end